home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 2537 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.6 KB  |  58 lines

  1. Path: news.onramp.net!usenet
  2. From: purple@haze.net
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem with c code, please help!
  5. Date: Mon, 22 Jan 1996 09:25:57 GMT
  6. Organization: On-Ramp; Individual Internet Connections; Dallas/Ft Worth/Houston, TX USA
  7. Message-ID: <4dvfa4$lfg@news.onramp.net>
  8. References: <surgsw-1901960148530001@128.206.206.86>
  9. NNTP-Posting-Host: stemmons15.onramp.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. surgsw@mizzou1.missouri.edu (Joel Weinstein) wrote:
  13.  
  14. >I have been trying to get this very simple piece of code to work for
  15. >hours.  What is the problem???????
  16.  
  17. >#include <stdio.h>
  18.  
  19. >main()
  20. >{
  21. >   int i=0;
  22. >   char  word[100], c;
  23. >   printf("Enter a word:   ");
  24. >   while( (c = getchar()) != '\n')  {
  25. >      *word = c;
  26. >      word == word + 1;
  27. >   }  
  28. >   printf("You entered:  ");  
  29. >   *word = 0;
  30. >   while( *word != '\n' )   
  31. >   {  
  32. >      putchar( *word );
  33. >      word == word + 1; 
  34. >   }
  35. >}  
  36.  
  37. >I think the problem I am having is due to my not knowing when to use the
  38. >'*' operator.  When do you use it?  Also, why won't my goddam compiler let
  39. >me do word++; instead of word == word +1;   I also tried to do *word++;
  40. >and it didn't work, what is the deal with that.  It won't let me put word
  41. >= word + 1;.  It insists on the double ='s.  Why is that?
  42.  
  43. >Please send e-mail.
  44.  
  45. >Joel
  46.  
  47. >ps: is there a way to find out what exactly error messages mean?  I kept
  48. >getting something similar to: not an Ivalue.  It would be nice if I knew
  49. >what the hell that meant.
  50.  
  51.  
  52. word == word + 1;  dosn;t do anything
  53. word = word + 1;  or word++;
  54. You will also have to restore word to the original base pointer
  55. between getting and printing word
  56.  
  57.  
  58.